package com.skywork.domain;

import java.util.Date;

import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.skywork.domain.base.IdEntity;
import com.skywork.utils.MyEnum;
import com.skywork.utils.MyEnumTypeHanlder;

import lombok.Data;
import lombok.EqualsAndHashCode;
import tk.mybatis.mapper.annotation.ColumnType;

@Data
@EqualsAndHashCode(callSuper=true)
@Table(schema = "cfg", name = "channel")
public class Channel extends IdEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public final static String[] IGNORE_COPY_FIELDS = { "id", "code", "createBy", "createDate", "modifyBy", "modifyDate", "expiresDate", "parentId" };

	// private Long shardingId;

	private String code;

	private String name;

	private String userName;
	
	private String password;

	private Date expiresDate;

	@JsonProperty("encrypt_key")
	private String encryptKey;

	@JsonProperty("decrypt_key")
	private String decryptKey;

	private Long parentId;
	
	private Long tokenExpiresIn;
	
	@ColumnType(typeHandler = MyEnumTypeHanlder.class)
	private ChannelRole channelRole; 
	
	public enum ChannelRole implements MyEnum {

		admin(-1),user(0);

		private int value;

		private ChannelRole(int value) {
			this.value = value;
		}

		@Override
		public int getValue() {
			return value;
		}
	}


}
